package homework.printyourself.info.items;

import homework.printyourself.info.BaseObject;
import homework.printyourself.info.items.utils.Gender;
import homework.valid.validators.ValidateChain;
import homework.valid.validators.impl.EnumValidator;

import java.io.IOException;


public class GenderItem extends BaseInformationItem {

    static {
        chain = new ValidateChain();
        chain.addValidator(new EnumValidator("输入有误, 请重输", Gender.values()));
    }

    public GenderItem(BaseObject obj) throws IOException {
        super(obj, null);
        itemName = "性别";
        itemValue = (String)fi.input("请输入性别[男/女]: ", chain);
    }

    public GenderItem(BaseObject obj, Gender gender) {
        super(obj, gender.toString());
        itemName = "性别";
    }
}
